import com.alibaba.druid.pool.DruidDataSource;

import java.sql.SQLException;

public class Main {
    public static void main(String[] args) {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mysql://localhost:3306/test");
        dataSource.setUsername("root");
        dataSource.setPassword("130258");
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        try{
            if(dataSource.getConnection()!=null){
                System.out.println("链接成功");
            }else{
                System.out.println("链接失败");
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}